package cn.yzgy.yzgyoa.common.exception;

import cn.yzgy.yzgyoa.common.crsp.StatusCode;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

/**
 * System Exception Class
 * Business layer exception uniformity thrown by the class
 *
 * @author Yqsen
 * @version 0.0.1
 * @since  2019-8-15 11:10:16
 */
public class SystemException extends RuntimeException{

    @Getter @Setter
    private StatusCode statusCode;
    @Getter @Setter
    private String msg;
    @Getter @Setter
    private Integer code;
    @Getter @Setter
    private String attachStr;

    public SystemException(StatusCode statusCode) {
        super(statusCode.toString());
        this.statusCode = statusCode;
        this.msg = statusCode.getMsg();
        this.code = statusCode.getCode();
    }

    public SystemException(StatusCode statusCode, String attachStr) {
        this(statusCode);
        this.attachStr = attachStr;
    }

}
